package com.haiya.decorator.basic;

public class Client {
    public static void main(String[] args) {
        /**
         * 1. 具体组件
         * 执行operation()方法就是原生的 具体组件operation()方法
         */
        System.out.println("具体组件: ------------------------------");
        Component component = new ConcreteComponent();
        component.operation();

        System.out.println("抽象装饰器: ------------------------------");
        component = new Decorator(component);
        component.operation();

        /**
         * 2. 实例化一个具体的装饰器
         * 然后再执行operation()方法，就会附加上装饰器的附加功能
         */
        System.out.println("装饰器: ------------------------------");
        component = new ConcreteDecorator1(component);
        component.operation();
    }
}
